{% load debate_tags i18n %}

<div class="col-md-5 col-12 mb-3">
  <div class="card">
    <div class="card-body text-center pb-1">
      <div class="progress">
        {% for threshold in c_thresholds %}

          {% if threshold.count != 0 %}
            {% widthratio threshold.count c_total 100 as c_percentage %}
            <div class="progress-bar rank-display ranking-{{ threshold.class }}" role="progressbar"
                 style="width: {{ c_percentage }}%;" data-toggle="tooltip"
                 title="{% blocktrans trimmed with min=threshold.min max=threshold.max percent=c_percentage|floatformat:"0" count count=threshold.count %}
                   {{ count }} adjudicator currently has a score equal to or above
                   {{ min }} and below {{ max }}. That is {{ percent }}% of the adjudicator pool.
                 {% plural %}
                   {{ count }} adjudicators currently have a score equal to or above
                   {{ min }} and below {{ max }}. That is {{ percent }}% of the adjudicator pool.
                 {% endblocktrans %}">
              {{ threshold.min|floatformat:"0" }}-{{ threshold.max|floatformat:"0" }} <!-- too cramped if only a small % -->
            </div>
          {% endif %}

        {% endfor %}
      </div>
      <h6 class="pt-3 text-center text-secondary">
        {% blocktrans trimmed with min_score=pref.adj_min_score max_score=pref.adj_max_score %}
          Score Distributions (range is {{ min_score }}–{{ max_score }})
        {% endblocktrans %}
      </h6>
    </div>
  </div>
</div>

<div class="col-md-2 col-12 mb-3 px-0">
  <div class="card">
    <div class="card-body text-center pb-1 pt-2 px-2">
      <div class="row">
        <div class="col pr-0 mb-0">
          <h5 class="mb-0 mt-2">
            {{ test_percent|floatformat:"0" }}%
          </h5>
          <small>{% trans "Base" %}</small>
        </div>
        <div class="col pl-0 mb-0">
          <h5 class="mb-0 mt-2">
            {{ feedback_percent|floatformat:"0" }}%
          </h5>
          <small>{% trans "Feedback" %}</small>
        </div>
      </div>
      <h6 class="pt-2 text-secondary" data-toggle="tooltip"
          title="{% blocktrans trimmed with round=current_round.abbreviation %}
            The proportion of an adjudicator's score determined by feedback vs the
            test is set on a per-round basis. Click this link and edit the 'Feedback weight' field to modify this ratio for {{ round }}.{% endblocktrans %}">
        <a href="{% url 'admin:tournaments_round_change' current_round.id %}" target="_blank">
          {{ current_round.abbreviation }} {% trans "Score Ratio" %}
        </a>
      </h6>
    </div>
  </div>
</div>

<div class="col-md-5 col-12 mb-3">
  <div class="card">
    <div class="card-body text-center pb-1">
      <div class="progress">
        {% if c_chairs > 0 %}
          <div class="progress-bar position-display chair" role="progressbar"
               style="width: {% percentage c_chairs c_total %}%;" data-toggle="tooltip"
              {% if c_chairs == c_debates %}
               title="{% blocktrans trimmed count count=c_chairs %}
                  There is {{ c_chairs }} debate per round, so there needs to be {{ c_chairs }} chair.
                {% plural %}
                  There are {{ c_chairs }} debates per round, so there need to be {{ c_chairs }} chairs.
                {% endblocktrans %}"
              {% else %}
               title="{% blocktrans trimmed count count=c_debates %}
                  There is {{ c_debates }} debate per round, but only {{ c_chairs }} above the minimum voting score.
                {% plural %}
                  There are {{ c_debates }} debates per round, but only {{ c_chairs }} above the minimum voting score.
                {% endblocktrans %}"
              {% endif %}
            >
            {% blocktrans trimmed count c_chairs=c_chairs %}
              {{ c_chairs }} chair
            {% plural %}
              {{ c_chairs }} chairs
            {% endblocktrans %}
          </div>
        {% endif %}
        {% if c_panellists > 0 %}
          <div class="progress-bar position-display panellist" role="progressbar"
               style="width: {% percentage c_panellists c_total %}%;" data-toggle="tooltip"
               title="{% blocktrans trimmed %}
                All adjudicators with a score high enough to vote, but who aren't allocated as chairs,
                are allocated as panellists by the auto-allocator.
               {% endblocktrans %}">
            {% blocktrans trimmed count c_panellists=c_panellists %}
              {{ c_panellists }} panellist
            {% plural %}
              {{ c_panellists }} panellists
            {% endblocktrans %}
          </div>
        {% endif %}
        {% if c_trainees > 0 %}
          <div class="progress-bar position-display trainee" role="progressbar"
               style="width: {% percentage c_trainees c_total %}%;" data-toggle="tooltip"
               title="{% blocktrans trimmed with min_voting=pref.adj_min_voting_score %}
                Adjudicators are allocated as trainees by the auto-allocator if their score is less
                than the 'minimum voting score' (currently {{ min_voting }}) set in this
                tournament's Draw Rules configuration.
               {% endblocktrans %}">
            {% blocktrans trimmed count c_trainees=c_trainees %}
              {{ c_trainees }} trainee
            {% plural %}
              {{ c_trainees }} trainees
            {% endblocktrans %}
          </div>
        {% endif %}
      </div>
      <h6 class="pt-3 text-center text-secondary">
        {% blocktrans trimmed with min_voting_score=pref.adj_min_voting_score %}
          Auto-Allocate Distributions ({{ min_voting_score }}+ to vote)
        {% endblocktrans %}
      </h6>
    </div>
  </div>
</div>
